<?php /*a:2:{s:50:"D:\phpstudy_pro\yifei\muban\view\admin\en\web.html";i:1755078063;s:48:"D:\phpstudy_pro\yifei\muban\view\admin\head.html";i:1755076919;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Web管理</title>
    <link rel="stylesheet" type="text/css" href="/static/admin/css/base.css">
<link rel="stylesheet" href="/static/admin/css/font.css">
<link rel="stylesheet" href="/static/admin/css/css.css">
<link rel="stylesheet" href="/static/admin/css/xadmin.css">
<script src="/static/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/admin/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="/static/admin/js/xadmin.js"></script>
<script type="text/javascript" src="/static/admin/js/fl.js"></script>
<script src="/static/admin/js/falan.js"></script>
<script>var lang = "<?php echo htmlentities((string) $lang); ?>"</script>
</head>

<body>
<div class="x-body">
    <div class="layui-form">
        <input type="text" id="id" name="id" value="<?php echo htmlentities((string) (isset($info['id']) && ($info['id'] !== '')?$info['id']:0)); ?>" style="display: none;">
        <div class="layui-form-item">
            <label class="layui-form-label">
                WebTitle
            </label>
            <div class="layui-input-inline">
                <input type="text" id="name" name="name" required lay-verify="required"
                       autocomplete="off" class="layui-input" value="<?php echo htmlentities((string) (isset($web['name']) && ($web['name'] !== '')?$web['name']:'')); ?>">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                WebDomain Name
            </label>
            <div class="layui-input-inline">
                <input type="text" id="web" name="name" required lay-verify="required"
                       autocomplete="off" class="layui-input" value="<?php echo htmlentities((string) (isset($web['web']) && ($web['web'] !== '')?$web['web']:'')); ?>">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                WebKeywords
            </label>
            <div class="layui-input-inline">
                <input type="text" id="keywords" name="name" required lay-verify="required"
                       autocomplete="off" class="layui-input" value="<?php echo htmlentities((string) (isset($web['keywords']) && ($web['keywords'] !== '')?$web['keywords']:'')); ?>">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                WebLOGO
            </label>
            <div class="layui-input-inline">
                <input type="text" id="image_id" value="<?php echo htmlentities((string) (isset($info['image_id']) && ($info['image_id'] !== '')?$info['image_id']:0)); ?>" style="display:none;">
                <input type="file" id="image-file" style="display: none;" onchange="imagefile(this)" accept="image/*">
                <img src="<?php echo htmlentities((string) (isset($info['image']) && ($info['image'] !== '')?$info['image']:'/static/admin/img/none.jpg')); ?>" id="image" onclick="imagesave()" style="max-width: 150px">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                WebContent
            </label>
            <div class="layui-input-inline">
                <textarea id="info" class="layui-textarea"><?php echo htmlentities((string) (isset($web['info']) && ($web['info'] !== '')?$web['info']:'')); ?></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                Footer Content
            </label>
            <div class="layui-input-inline">
                <textarea id="footer" class="layui-textarea"><?php echo htmlentities((string) (isset($web['footer']) && ($web['footer'] !== '')?$web['footer']:'')); ?></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                Confirm
            </button>
        </div>
    </div>
</div>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;
        //监听提交
        form.on('submit(add)', function(data){
            let message = {
                name:document.getElementById('name').value,
                web:document.getElementById('web').value,
                keywords:document.getElementById('keywords').value,
                image_id:document.getElementById('image_id').value,
                info:document.getElementById('info').value,
                footer:document.getElementById('footer').value
            };
            console.log(message);
            //发异步，把数据提交给php
            post('/sys/web',message,'result');
        });
    });
    function post_result(res){
        if (res.code == 400) {
            layer.msg(res.msg,{icon:2,time:1000});
        }else{
            location.reload();
        }
    }
</script>
</body>
</html>